// 响应拦截器
axios.interceptors.response.use(
    res => {
        if (res.data.code === 0 && res.data.msg === 'NOTLOGIN') {// 返回登录页面
            console.log('/backend/login.html---', res.data.code);
            localStorage.removeItem('userInfo');
            window.top.location.href = '/backend/login.html';
        } else {
            return res
        }
    },
    error => {
        console.log('err' + error);
        let {message} = error;
        if (message == "Network Error") {
            message = "后端接口连接异常";
        } else if (message.includes("timeout")) {
            message = "系统接口请求超时";
        } else if (message.includes("Request failed with status code")) {
            message = "系统接口" + message.substr(message.length - 3) + "异常";
        }
        return Promise.reject(error)
    }
);